import { getConfig } from '@/services/config'

const state = {
	config: null
}

const mutations = {
	SET_CONFIG(state, config) {
		state.config = config
	}
}

const actions = {
	async getConfig({ commit }) {
		try {
			const response = await getConfig()
			commit('SET_CONFIG', response.data)
			return response.data
		} catch (error) {
			console.error('获取配置失败:', error)
			throw error
		}
	},
}

export default {
	namespaced: true,
	state,
	mutations,
	actions
} 